#include <stdio.h>

#define IN  1
#define OUT 0

int main()
{
    int c, state, laststate;

    state = OUT;
    laststate = OUT;

    while ((c = getchar()) != EOF)
    {
        if(c == ' ' || c == '\t' || c == '\n')
        {
            state = OUT;            
        }
        else if(state == OUT)
        {
            state = IN;
        }        

        if(state == IN)
        {
            putchar(c);
        }
        else if(laststate != OUT)
        {
            printf("\n");
        }
        
        laststate = state;
    }

    return 0;
}